//神农IT服务
export const Collaboration_APP = {
    id: 'wx61e58b1aa9447b14',
    sourceID: 'gh_8ee19b14ee1f',
    AppSecret: 'E144CECFF08AC140A268108EE55FE409',
};

//神农信息服务
export const Service_APP = {
    id: 'wxbdeed4bcfcaae58f',
    sourceID: 'gh_c0f977d77b92',
    AppSecret: '157A5B41850DE856E3B442CEB5D10793',
};

// 神农IT服务测试号
// export const TEST_NUMBER = {
//     id: "wxab16114c0733a512",
//     sourceID: 'gh_beb5a934e003',
// };

// 神农IT服务测试号 （寸）
export const TEST_NUMBER = {
    id: 'wx7429f9fc58f35ce5',
    sourceID: 'gh_94f4b4e471ab',
};

// YY服务测试号 （辉）
export const YY_NUMBER = {
    id: 'wx7429f9fc58f35ce5',
    sourceID: 'gh_94f4b4e471ab',
};

// 神农信息服务测试号 （孙）
export const TEST_INFO_NUMBER = {
    id: 'wx32ae207716b83acc',
    sourceID: 'gh_ed3f734c86ea',
};

const server = (type, batn) => {
    let val;
    switch (batn) {
        case 'id':
            val = {
                [Collaboration_APP.sourceID]: Collaboration_APP.id,
                [Service_APP.sourceID]: Service_APP.id,
                [TEST_NUMBER.sourceID]: TEST_NUMBER.id,
                [YY_NUMBER.sourceID]: YY_NUMBER.id,
                [TEST_INFO_NUMBER.sourceID]: TEST_INFO_NUMBER.id,
            }[type];
            break;
        case 'sid':
            val = {
                [Collaboration_APP.sourceID]: Collaboration_APP.sourceID,
                [Service_APP.sourceID]: Service_APP.sourceID,
                [TEST_NUMBER.sourceID]: TEST_NUMBER.sourceID,
                [YY_NUMBER.sourceID]: YY_NUMBER.sourceID,
                [TEST_INFO_NUMBER.sourceID]: TEST_INFO_NUMBER.sourceID,
            }[type];
            break;
        case 'secret':
            val = {
                [Collaboration_APP.sourceID]: Collaboration_APP.AppSecret,
                [Service_APP.sourceID]: Service_APP.AppSecret,
            }[type];
            break;
        default:
            break;
    }
    return val;
};

/**
 * 根据地址解析服务AuthZ
 * @param {*} type
 * @returns
 */
export const getAuthZ = (type, batn) => {
    return server(type, batn);
};
